package myjava.IO;

import java.io.*;

public class Root {

   private static int nFile = 0;

   private static void listFileFolder(File dir) {
      if (!dir.isDirectory()) {
         return;
      }
      File[] files = dir.listFiles();
      for (File f : files) {
         if (f.isFile()) {
            Root.nFile++;
            System.out.println(f.getName());
         } else {
            Root.listFileFolder(f);
         }
      }
   }

   public static void main(String[] args) {
      File dir = new File("/home/nourdine/development/my_dev/repository");
      Root.listFileFolder(dir);
      System.out.println("Totale file : " + Root.nFile);
   }
}